﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Dynamic.Core.CustomTypeProviders;
using System.Text;
using System.Threading.Tasks;

namespace Framework.SqlSugar;

/// <summary>
/// 扩展支持 SqlFunc，不支持 Subqueryable
/// </summary>
public class SqlSugarTypeProvider : DefaultDynamicLinqCustomTypeProvider
{
	public SqlSugarTypeProvider(bool cacheCustomTypes = true) : base(ParsingConfig.Default, cacheCustomTypes)
	{
	}

	public override HashSet<Type> GetCustomTypes()
	{
		var customTypes = base.GetCustomTypes();
		customTypes.Add(typeof(SqlFunc));
		return customTypes;
	}
}
